import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
    history: createWebHistory(),
    routes: [
        {
            path: '/login',
            name: 'Login',
            component: () => import('@/views/Login.vue')
        },
        {
            path: '/',
            name: 'Layout',
            component: () => import('@/views/Layout.vue'),
            redirect: '/dashboard',
            children: [
                {
                    path: 'dashboard',
                    name: 'Dashboard',
                    component: () => import('@/views/Dashboard.vue')
                },
                {
                    path: 'system/user',
                    name: 'UserManagement',
                    component: () => import('@/views/system/UserManagement.vue')
                },
                {
                    path: 'system/role',
                    name: 'RoleManagement',
                    component: () => import('@/views/system/RoleManagement.vue')
                },
                {
                    path: 'system/permission',
                    name: 'PermissionManagement',
                    component: () => import('@/views/system/PermissionManagement.vue')
                }
            ]
        },
        {
            path: '/:pathMatch(.*)*',
            name: 'NotFound',
            component: () => import('@/views/404.vue')
        }
    ]
})

// 简化的路由守卫
router.beforeEach((to, from, next) => {
    // 暂时跳过权限检查，直接放行
    next()
})

export default router 